#ifndef __NONAME_STRING_H__
#define __NONAME_STRING_H__

#define NONAME_LIB_USE

#include <ntifs.h>
#include "nm_mem.h"
#include <ntstrsafe.h>

class kstringw {

public:
	kstringw();
	kstringw(PWCHAR String);
	kstringw(PUNICODE_STRING UniString);
	void Release();

	PWCHAR Allocate(ULONG size, BOOLEAN SaveData = FALSE);
	void Append(WCHAR ch);
	void Attach(PWCHAR String);
	INT Compare(PWCHAR String, BOOLEAN CaseInsensitive = TRUE);
	void Copy(PWCHAR String, ULONG Cch = 0);
	PWCHAR Detach();
	void Empty();
	INT Find(WCHAR ch, INT Start);
	INT Find(PWCHAR String, INT Start);
	INT Format(__in PWCHAR Formats, ...);
	WCHAR GetAt(__in ULONG idx);
	INT GetLength() const;
	PWCHAR GetString() const;
	PUNICODE_STRING GetUnicodeString();
	BOOLEAN IsEmpty() const;
	void Left(ULONG Cch);
	void MakeUpper();
	void MakeLower();
	void Mid(ULONG Start, ULONG Cch);
	void Right(ULONG Cch);
	INT Replace(PWCHAR Old, PWCHAR New);
	INT ReverseFind(WCHAR ch);
	WCHAR SetAt(ULONG pos, WCHAR ch);

	operator PWCHAR() const;
	operator PUNICODE_STRING();
	kstringw& operator=(PWCHAR String);
	kstringw& operator=(PUNICODE_STRING UniString);
	kstringw& operator=(const kstringw& str);
	BOOLEAN operator==(kstringw& str2);
	BOOLEAN operator==(PWCHAR str2);
	const kstringw& operator+=(PUNICODE_STRING UniString);
	const kstringw& operator+=(PWCHAR String);
	const kstringw& operator+=(const kstringw& str);
	const kstringw& operator+=(WCHAR ch);
	WCHAR operator[](ULONG idx);

private:

	PWCHAR m_stringw;
	ULONG m_len;
	UNICODE_STRING m_UniString;
};

#endif